Skip to content

gh-126703: Fix possible use after free in pycfunction freelist#132319

Merged
Fidget-Spinner merged 4 commits into
python:mainfrom
Fidget-Spinner:freelist-fix
Apr 9, 2025
Merged

gh-126703: Fix possible use after free in pycfunction freelist#132319
Fidget-Spinner merged 4 commits into
python:mainfrom
Fidget-Spinner:freelist-fix

Conversation

@Fidget-Spinner

@Fidget-Spinner Fidget-Spinner commented Apr 9, 2025

Copy link
Copy Markdown
Member

@Fidget-Spinner Fidget-Spinner changed the title gh-128692: Fix possible use after free in pycfunction freelist gh-126703: Fix possible use after free in pycfunction freelist Apr 9, 2025
@Fidget-Spinner

Copy link
Copy Markdown
Member Author

@hawkinsp does this look right to you?

Comment thread Objects/methodobject.c Outdated
PyObject_ClearWeakRefs((PyObject*) m);
}
// We need to access ml_flags here rather than later.
// `m` might have the same lifetime

@hawkinsp hawkinsp Apr 9, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m->m_ml I think here, but yes.

You are also right that probably we should update the API documentation to clarify this is an acceptable thing to do.

@Fidget-Spinner Fidget-Spinner merged commit bd3aa0b into python:main Apr 9, 2025
@Fidget-Spinner Fidget-Spinner deleted the freelist-fix branch April 9, 2025 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants